package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.SpuImagesEntity;
import com.bush.mall.product.service.SpuImagesService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * spu图片
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("spuimages")
@Api(tags = "spu图片管理" )
public class SpuImagesController {

    @Resource(name= SpuImagesService.BEAN_ID)
    private SpuImagesService spuImagesService;

    /**
     * 分页查询spu图片列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询spu图片列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return spuImagesService.queryForPage(current,size);
    }

    /**
     * 保存spu图片表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存spu图片表单")
    @PostMapping("saveSpuImages")
    public Result saveSpuImages(@RequestBody SpuImagesEntity spuImages){
        return spuImagesService.saveSpuImages(spuImages);
    }

    /**
     * 修改spu图片表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改spu图片表单")
    @PutMapping("updateSpuImages")
    public Result updateSpuImages(@RequestBody SpuImagesEntity spuImages){
        return spuImagesService.updateSpuImages(spuImages);
    }

    /**
     * 通过指定id删除spu图片
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除spu图片")
    @DeleteMapping("deleteSpuImages")
    public Result deleteSpuImages(Long id){
        return spuImagesService.deleteSpuImages(id);
    }

}
